package cn.lastjune.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/selectFields")
public class FilterFieldsController
{
    @RequestMapping(method = RequestMethod.POST)
    public void getFields(HttpServletRequest request, HttpServletResponse response) throws IOException
    {
        PrintWriter out = response.getWriter();
        System.out.println(request.getParameter("filterFields"));
        String[] filterFields = request.getParameter("filterFields").split(",");

        // 字段结果值
        String fields = "";
        // wait fix update this is just for test functional
        for (int i = 0; i < filterFields.length; i++)
        {
            if (filterFields[i].equals("baseV"))
            {
                fields = fields
                        + "[{typeID:'bigcategory',typeValue:'大类'},{typeID:'smallcategory',typeValue:'小类'},{typeID:'subcategory',typeValue:'子类'}]";
            }
            if (filterFields[i].equals("timeV"))
            {
                fields += "[{typeID:'bigcategory',typeValue:'受理开始时间'},{typeID:'smallcategory',typeValue:'小类'},{typeID:'subcategory',typeValue:'子类'}]";
            }
            if (filterFields[i].equals("zoneV"))
            {

            }
            if (filterFields[i].equals("deptV"))
            {

            }
            if (filterFields[i].equals("stepV"))
            {

            }
            if (filterFields[i].equals("baseT"))
            {

            }
            if (filterFields[i].equals("implT"))
            {

            }
            if (filterFields[i].equals("dealT"))
            {

            }
            if (filterFields[i].equals("dispatchT"))
            {

            }
        }
        out.print(fields);
        out.flush();
    }
}
